<template>
  <el-config-provider :locale="currentElementLocale">
    <router-view />
  </el-config-provider>
</template>

<script setup>
import { handleThemeStyle } from '@/utils/theme'
import { useI18n } from 'vue-i18n'
import { ElConfigProvider } from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'

import { useSettings } from '@/composables/useSettings'
const { theme } = useSettings()

onMounted(() => {
  nextTick(() => {
    // 初始化主题样式
    handleThemeStyle(theme.value)
  })
})

// 国际化
const { locale } = useI18n()
const currentElementLocale = computed(() => {
  return locale.value === 'zh' ? zhCn : en
})
</script>
